using System;
using System.Windows.Forms;

using FreeFlow.Administration;

namespace FreeFlowAdministrator
{
	/// <summary>
	/// Summary description for ColumnsAdaptor.
	/// </summary>
	public class ColumnsAdaptor : Adaptor
	{
    private ColumnCollection columns;
    public ColumnsAdaptor(ColumnCollection columns)
		{
			this.columns = columns;
		}

    public override string Text
    {
      get
      {
        return "Columns (" + columns.Count + ")";
      }
    }

    public override object Object
    {
      get
      {
        return columns;
      }
    }

    public override void AddChildren(TreeNode node)
    {
      foreach (Column column in columns)
      {
        TreeNode childNode = TreeNodeFactory.CreateTreeNode(new ColumnAdaptor(column));
        node.Nodes.Add(childNode);
      }
    }

    public override int ImageIndex
    {
      get
      {
        return 36;
      }
    }

    public override Control GetRenderer()
    {
      ColumnsControl control = new ColumnsControl();
      control.LoadColumns(columns);
      return control;
    }
	}
}
